package com.db.patterns.singleton.demo09;

/**
 * 懒汉式
 */
public class Singleton {
    private static Singleton instance;

    // 构造方法私有化，防止外界利用new 创建类的实例
    private Singleton() {

    }

    public static Singleton getInstance() {
        if (instance == null) {
            instance = new Singleton();
        }
        return instance;
    }
}
